#include "comm.hpp"

int main()
{
    int shmId = SharedMeory::getShm();

    // 挂接到进程地址空间
    char *shmAddr = (char *)shmat(shmId, nullptr, 0);

    int fd = open(FIFO_FILE,O_WRONLY);  
    if(fd < 0){
        perror("open");
        exit(FIFO_OPEN_ERR);
    }

    while (true)
    {
        std::cout << "please Enter@ ";
        fgets(shmAddr, 4096, stdin);

        //通知对端，
        char c = 'c';
        write(fd,&c,sizeof(c));

        sleep(1);
    }

    // 去关联
    shmdt(shmAddr);

    return 0;
}